import Mock from 'mockjs';
const baseUrl = 'http://127.0.0.1:8081';
// 登录接口
Mock.mock(`${baseUrl}/login`, 'post', (option) => {
  let request = JSON.parse(option.body);
  if (request.username === 'admin' && request.password === 'admin@123') {
    return {
      success: true,
      msg: '登录成功',
      data: {
        token: Mock.mock('@word(15)')
      }
    }
  } else {
    return {
      success: false,
      code: 'login_fail_1',
      msg: '登录失败，账号为admin，密码admin@123',
      data: {}
    }
  }
});
